# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  include AuthenticatedSystem
  before_filter :get_root_pages
  before_filter :load_current_user
  helper :all # include all helpers, all the time
  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '4c3b846a5c995b94ad77ffa39bda46de'
    
  def get_root_pages
      @root_pages_public = Page.find(:all, :conditions => [" root_page = true and private_page = false"])
      if logged_in?
        @root_pages_private = Page.find(:all, :conditions => [" root_page = true and private_page = true"])
      end
  end
  def load_current_user
    if logged_in?
      @user = current_user
    else
      false
    end
  end
end
